// import vue from "vue";
// import SiteManagement from "../../api/api";
// 暂时存储所有的路由数据，后续加权限管理的时候，依据路由进行权限控制
const routerArr = {
  state: {
    routerDataArr: [],
    buttonList: [], // 按钮权限
    moduleFieldConfigList: [], // 模块权限
    routerDataArrNotLogin: [
      {
        path: "/witness",
        name: "witness",
        title: "见证任务",
        meta: {
          index: "1",
          key: "witness"
        },
        children: [
          {
            path: "/ManageList",
            name: "ManageList",
            title: "见证任务管理",
            meta: {
              index: "1-1",
              key: "ManageList"
            },
            icon: "icon-live-zhiboguanli"
          },
          {
            path: "/PostCalendar",
            name: "PostCalendar",
            title: "在岗日历",
            meta: {
              index: "1-1",
              key: "PostCalendar"
            },
            icon: "icon-live-zhiboguanli"
          },
          {
            path: "/TaskList",
            name: "TaskList",
            title: "见证任务",
            meta: {
              index: "1-2",
              key: "TaskList"
            },
            icon: "icon-live-zhiboguanli"
          },
          {
            path: "/System",
            name: "System",
            title: "系统管理",
            meta: {
              index: "1-3",
              key: "System"
            },
            showChild: true,
            icon: "icon-live-zhiboguanli",
            children: [
              {
                path: "/TheRules",
                name: "TheRules",
                title: "见证规则管理",
                meta: {
                  index: "1-3-1",
                  key: "systemManagement"
                },
                icon: "icon-live-zhiboguanli"
              },
              {
                path: "/systemManagement",
                name: "systemManagement",
                title: "见证事项管理",
                meta: {
                  index: "1-3-2",
                  key: "systemManagement"
                },
                icon: "icon-live-zhiboguanli"
              },
              {
                path: "/UserManagement",
                name: "UserManagement",
                title: "用户管理",
                meta: {
                  index: "1-3-3",
                  key: "UserManagement"
                },
                icon: ""
              }
            ]
          },
          {
            path: "/Workbench",
            name: "Workbench",
            title: "见证工作台",
            meta: {
              index: "1-4",
              key: "Workbench"
            },
            icon: "icon-live-feiyongguanli"
          }
          // {
          //   path: "/WitnessTable",
          //   name: "WitnessTable",
          //   title: "见证工作台",
          //   meta: {
          //     index: "1-5",
          //     key: "WitnessTable",
          //   },
          //   icon: "icon-live-feiyongguanli",
          // },
        ]
      }
    ]
  },
  mutations: {
    setHeadNav(state, data) {
      state.routerDataArr = data;
    },
    setButtonList(state, data) {
      state.buttonList = data;
    },
    setModuleFieldConfigList(state, data) {
      state.moduleFieldConfigList = data;
    }
  },
  actions: {
    setHeadNavAction(context, data) {
      console.log("setHeadNavAction", data);
      context.commit("setHeadNav", data);
    },
    setButtonListAction(context, data) {
      context.commit("setButtonList", data);
    },
    async setModuleFieldConfigListAction(context, data) {
      context.commit("setModuleFieldConfigList", data);
      // const res = await SiteManagement.init({ moduleName: "REGION" });
      // if (res.success) {
      //   context.commit(
      //     "setModuleFieldConfigList",
      //     res.data.moduleFieldConfigList
      //   );
      //   // this.setModuleFieldConfigListAction(res.data.moduleFieldConfigList);
      // }
    }
  }
};
export default routerArr;
